home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / bash_completion.d / python < prev    next >
Encoding:
Text File  |  2010-11-16  |  1.1 KB  |  59 lines

  1. # bash completion for python
  2.  
  3. have python &&
  4. _python()
  5. {
  6.     local prev cur i
  7.  
  8.     COMPREPLY=()
  9.     _get_comp_words_by_ref cur prev
  10.  
  11.     case $prev in
  12.     -Q)
  13.         COMPREPLY=( $( compgen -W "old new warn warnall" -- "$cur" ) )
  14.         return 0
  15.         ;;
  16.     -W)
  17.         COMPREPLY=( $( compgen -W "ignore default all module once error" \
  18.             -- "$cur" ) )
  19.         return 0
  20.         ;;
  21.     -c)
  22.         _filedir '@(py|pyc|pyo)'
  23.         return 0
  24.         ;;
  25.     !(python|-?))
  26.         [[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir
  27.         ;;
  28.     esac
  29.  
  30.  
  31.     # if '-c' is already given, complete all kind of files.
  32.     for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
  33.         if [[ ${COMP_WORDS[i]} == -c ]]; then
  34.             _filedir
  35.         fi
  36.     done
  37.  
  38.  
  39.     if [[ "$cur" != -* ]]; then
  40.         _filedir '@(py|pyc|pyo)'
  41.     else
  42.         COMPREPLY=( $( compgen -W "- -d -E -h -i -O -Q -S -t -u \
  43.             -U -v -V -W -x -c" -- "$cur" ) )
  44.     fi
  45.  
  46.  
  47.  
  48.     return 0
  49. } &&
  50. complete -F _python -o filenames python
  51.  
  52. # Local variables:
  53. # mode: shell-script
  54. # sh-basic-offset: 4
  55. # sh-indent-comment: t
  56. # indent-tabs-mode: nil
  57. # End:
  58. # ex: ts=4 sw=4 et filetype=sh
  59.